app.service('couponsService',['$q','utilService',function($q,utilService){
    var _this_=this;
    _this_.coupons={
        status:0
    };

    //修改优惠卷状态
    _this_.updateCouponsStatus=function($scope){
        _this_.coupons.id=$scope.couponsId;

        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain+"coupons",
            data:_this_.coupons,
            method:'PUT'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    }

    this.delCoupons = function($scope){
        var deferred = $q.defer();
        utilService.api({
            url:$scope.app.domain + 'all/coupons/del',
            data:{couponsId:$scope.param.couponsId},
            method:'PUT'
        }).then(function(result){
            deferred.resolve(result);
        });
        return deferred.promise;
    }

}])